<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="UTF-8"%>
<jsp:useBean id="user" class="eai.tp2.lpco.web.beans.UserBean" scope="session" />
<jsp:useBean id="cart" class="eai.tp2.lpco.web.beans.Cart" scope="session" />
<jsp:useBean id="camera" class="eai.tp2.lpco.web.beans.Camera" scope="request" />
<% 
	String cartLink = ""; 
	if(cart.cartContains(camera.getModelName())) {
		cartLink = "<div style=\"border-top:1px solid #999999;\"><img src=\"imagens/cart_remove.png\" width=\"16\" height=\"16\" alt=\"Remove from Cart\"/>&nbsp;<a href=\"CartOrder?do=remove&name="+camera.getModelName()+"\" class=\"text-link\">&nbsp;remove&nbsp;cart</a></div>";
	}else {
		cartLink = "<div style=\"border-top:1px solid #999999;\"><img src=\"imagens/cart_add.png\" width=\"16\" height=\"16\" alt=\"Add to Cart\"/>&nbsp;<a href=\"CartOrder?do=add&name="+camera.getModelName()+"\" class=\"text-link\">&nbsp;add&nbsp;cart&nbsp;</a></div>";
	}	
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt" lang="pt">
<head>
<title>Low-Price Cameras</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="javascript" src="javascript/sub-menus.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style/style.css"  />
</head>
<body> 
<table width="845" border="0" cellspacing="0" cellpadding="0"> 
  <tr> 
       <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="5" ><div class="margem-direita"><img src="imagens/top.gif" width="850" height="108" alt="" /></div></td> 
  </tr> 
  <tr> 
    <td colspan="5" ></td> 
  </tr> 
  <tr> 
    <td colspan="5"></td> 
  </tr> 
  <tr> 
    <td width="10" rowspan="9">&nbsp;</td> 
    <td colspan="3"></td> 
    <td width="40" rowspan="9">&nbsp;</td> 
  </tr> 
  <tr> 
    <td>&nbsp;</td> 
    <td colspan="2" valign="top"></td> 
  </tr> 
  <tr> 
    <td width="188"><div class="menu"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr>
          <td width="76%"> </td>
          <td width="24%"> </td>
        </tr>
        <%
        	if (user.isLogged()) {
        		out
        				.print("<tr>"
        						+ "<td> "
        						+ "<div class=\"normal-text\">"+user.getUsername()+"</div></td>"
        						+ "<td align=\"right\"><form action=\"Logout\" method=\"post\"><input class=\"botao-login\" name=\"bLogout\" type=\"submit\" value=\"Logout\" /></form></td>"
        						+ "</tr>");
        	} else {
        		out
        				.print("<form name=\"login-form\" method=\"post\"  id=\"login-form\" action=\"Authentication\">"
        						+ "<tr>"
        						+ "<td><div class=\"normal-text\">Username:</div></td>"
        						+ "<td align=\"right\"><input  name=\"username\" type=\"text\" class=\"textfield-login\" size=\"15\"/></td>"
        						+ "</tr>"
        						+ "<tr>"
        						+ "<td><div class=\"normal-text\">Password:</div></td>"
        						+ "<td align=\"right\"><input  name=\"password\" type=\"password\" class=\"textfield-login\" size=\"15\"/></td>"
        						+ "</tr>"
        						+ "<tr>"
        						+ "<td> </td>"
        						+ "<td align=\"right\"><input type=\"submit\" name=\"Submit\" value=\"Login\" class=\"botao-login\"/></td>"
        						+ "</tr>"
        						+ "<tr>"
        						+ "<td colspan=\"2\"><a href=\"register.html\" class=\"text-link\"> register </a></td>"
        						+ "</tr>" + "</form>");
        	}
         %>
        <tr>
          <td colspan="2" style="border-bottom:1px solid #999999; "> </td>
        </tr>
        <tr>
          <td colspan="2" style="border-bottom:1px solid #999999; "><a href="javascript:submenu('sub-menu-1')" class="menu-item"><img src="imagens/down.png" width="5" height="5" id="sub-menu-1-img" class="img" alt=""/>&nbsp;Orders</a><a href="cart.jsp" style="display:none;" id="sub-menu-1" class="menu-item">&nbsp;Cart</a><a href="DatabaseOrder?do=historic" style="display:none;" id="sub-menu-1-1" class="menu-item">&nbsp;Historic</a></td>
          </tr>
        <tr> 
          <td colspan="2" style="border-bottom:1px solid #999999; "><a href="index.jsp" class="menu-item">&nbsp;List</a></td> 
          </tr> 
        <tr> 
          <td colspan="2" style="border-bottom:1px solid #999999; "><a href="search.jsp" class="menu-item">&nbsp;Search</a></td> 
          </tr> 

        <tr>
          <td colspan="2" style="border-bottom:1px solid #999999; "><a href="DatabaseUser?do=personal" class="menu-item">&nbsp;Personal Info</a></td>
        </tr>
        <tr>
          <td colspan="2"/>
        </tr>
        <tr>
          <td colspan="2"> </td>
        </tr>
        <tr> 
          <td colspan="2"/> 
          </tr> 
      </table>
    </div></td> 
    <td style="width: 50px;">&nbsp;</td>
    <td colspan="2" valign="top"><div class="normal-text-hline"><a href="javascript: history.go(-1)" class="text-link">&nbsp;back&nbsp;</a></div><table width="100%" border="0" cellspacing="3" cellpadding="0"> 
            <tr > 
              <td ><h1><img src="<% out.print(camera.getImageLink()); %>" /><% out.print(camera.getModelName()); %></h1><% out.print(cartLink); %></td> 
              <td align="left" ></td> 
            </tr> 
             <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Brand:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getBrandName()); %></td>
            </tr>  
            <tr >
              <td bgcolor="#CCCCCC" style="width: 202px"><h2>&nbsp;Descripton:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getDescription()); %></td>
            </tr>                               
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Min Shutter:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getMinShutter()); %></td>
            </tr>  
             <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Max Shutter:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getMaxShutter()); %></td>
            </tr>  
             <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Min Resolution:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getMinRes()); %></td>
            </tr>  
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Max Resolution:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getMaxRes()); %></td>
            </tr>    
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Effective Pixels:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getEffectivePixels()); %></td>
            </tr> 
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Image Ratio:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getImageRatio()); %></td>
            </tr> 
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Sensor Size:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getSensorSize()); %></td>
            </tr> 
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Iso Rating:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getIsoRating()); %></td>
            </tr> 
			<tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Announced Date:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getDate()); %></td>
            </tr>     
            <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Price:</h2></td>
              <td align="left" bgcolor="#CCCCCC" class="normal-text" >&nbsp;<% out.print(camera.getPrice()+" Euros"); %></td>
            </tr>              
              <tr >
              <td bgcolor="#CCCCCC"><h2>&nbsp;Review Link:</h2></td>
              <td align="left" bgcolor="#CCCCCC"><a href="<% out.print(camera.getReviewLink()); %>" class="text-link">&nbsp;link</a></td>
            </tr>                 
            <tr>
              <td align="right"></td>
              <td align="right"></td>
            </tr>
            <tr> 
              <td colspan="2"></td> 
            </tr> 
    </table></td> 
  </tr> 
  <tr>
    <td>&nbsp;</td>
    <td rowspan="6" valign="top">&nbsp;</td>
    <td valign="top"></td>
  </tr>
  <tr> 
    <td rowspan="3"></td> 
    <td valign="top">     
    </td>
  </tr>
  <tr>
    <td valign="top"></td>
  </tr>
  <tr>
    <td valign="top"></td>
  </tr> 
  <tr> 
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr> 
  <tr> 
    <td valign="top"></td> 
     <td valign="top"></td>
  </tr> 
  <tr> 
    <td colspan="5"></td> 
  </tr> 
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td rowspan="3">&nbsp;</td>
    <td></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td colspan="5"><div class="margem-baixo">&nbsp;</div></td> 
  </tr> 
  <tr> 
    <td width="10">&nbsp;</td> 
    <td></td> 
    <td width="40">&nbsp;</td> 
    <td width="574">&nbsp;</td> 
    <td width="40">&nbsp;</td> 
  </tr> 
</table> 
</body>
</html>
